package com.wande.dataplatform.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.wande.common.mybatis.core.domain.BaseEntity;
import com.wande.common.tenant.core.TenantEntity;
import com.wande.dataplatform.domain.vo.DataApiVO;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serial;

/**
 * 数据服务API实体
 *
 * @author wande
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("dp_data_api")
@AutoMapper(target = DataApiVO.class)
public class DataApi extends TenantEntity {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * API ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * API名称
     */
    private String name;

    /**
     * API路径
     */
    private String path;

    /**
     * 请求方法: GET, POST
     */
    private String method;

    /**
     * SQL模板
     */
    private String sqlTemplate;

    /**
     * 请求参数定义(JSON)
     */
    private String requestParams;

    /**
     * 返回字段定义(JSON)
     */
    private String responseFields;

    /**
     * 鉴权类型: TOKEN, API_KEY, OAUTH
     */
    private String authType;

    /**
     * 状态: DRAFT-草稿, PUBLISHED-已发布, OFFLINE-已下线
     */
    private String status;

    /**
     * 版本号
     */
    private String version;

    /**
     * 限流配置(次/秒)
     */
    private Integer rateLimit;

    /**
     * 脱敏规则(JSON)
     */
    private String desensitizeRules;

    /**
     * API描述
     */
    private String description;

    /**
     * 项目ID
     */
    private Long projectId;
}
